<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreatePersonalDataTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('personal_data', function (Blueprint $table) {
            $table->id()->from(config('migration.from'));

            $table->bigInteger('user_id')->unsigned();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');

            $table->string('fio')->nullable();
            $table->boolean('without_patronymic')->default(false);

            $table->date('birth_date')->nullable();
            $table->string('position')->nullable();
            $table->string('ogrnip')->nullable();
            $table->string('inn')->nullable();
            $table->string('snils')->nullable();
            $table->string('birth_place')->nullable();
            $table->string('registration_address')->nullable();
            $table->boolean('address_matches')->default(false);
            $table->string('residence_address')->nullable();

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('personal_data');
    }
}
